{% extends "base.html" %}
{% block main %}
    {% if results is defined %}
        {% import "elements.html" as render with context %}
        {% for result in results %}
            <div
                    {% if result.id %}id="t{{ result.id }}" {% endif %}
                    class="tweet {{ loop.cycle('odd', 'even') }}
                    {% if loop.length > 1 and result.highlight %} reply{% endif %}
                    {% if result.current %} current{% endif %}">
                {% if result.max_position %}
                    {% if result.action == "mention" %}
                        {{ render.render_tweet(result.target_objects|first) }}
                    {% elif result.action == "reply" %}
                        {{ render.render_tweet(result.targets|first) }}
                    {% elif result.action == "follow" %}
                        {{ render.render_follow(result) }}
                    {% elif result.action == "favorite" %}
                        {{ render.render_favorite(result) }}
                    {% elif result.action == "retweet" %}
                        {{ render.render_retweet(result) }}
                    {% elif result.action == "list_member_added" %}
                        {{ render.render_list_member_added(result) }}
                    {% endif %}
                {% else %}
                    {{ render.render_tweet(result) }}
                {% endif %}
            </div>
        {% else %}
            <p>No tweets to display.</p>
        {% endfor %}
    {% endif %}
{% endblock main %}